

package com.etop.beans;

import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity                             // Hibernate的映射，映射到数据库
@Table(name="sign_in")                 // 名字必须与数据库sign_in表名称一致
public class Registration {
    private int id;            // 数据库生成的id
    private int u_id;          // 用户id
    private Date signTime;     // 签到时间
    
    /**
     * @return the id
     */
    @Id                                 // 主键，必须要有@Id
    @GeneratedValue                     // ID的生成策略，GenerateValue代表自动增长 
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @return the u_id
     */
    public int getU_id() {
        return u_id;
    }

    /**
     * @param u_id the u_id to set
     */
    public void setU_id(int u_id) {
        this.u_id = u_id;
    }

    /**
     * @return the signTime
     */
    @Column(name="time")
    public Date getSignTime() {
        return signTime;
    }

    /**
     * @param signTime the signTime to set
     */
    public void setSignTime(Date signTime) {
        this.signTime = signTime;
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss ");
        return sdf.format(signTime);
    }
    
    
}
